package com.css.usercenter.study;

import com.css.usercenter.study.entity.User;
import com.css.usercenter.study.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.client.ServiceInstance;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("test")
public class TestController {
    @Autowired
    private DiscoveryClient discoveryClient;

    @GetMapping("client")
    public List<ServiceInstance> getdisveryClient() {
        return discoveryClient.getInstances("user_center");
    }

    @Autowired
    private UserService userService;

    @GetMapping("/id")
    public void get() {
        User byId = userService.getById(1);
    }
}
